<include file="Remark:header"/>
<div class="wraper">
    <div class="top index-top">
        <div class="logobox">
            <img class="logo1" src="/assets/activity/remark/images/logo1.png"/>
            <img class="logo2" src="/assets/activity/remark/images/logo2.png"/>
        </div>
        <img class="theme" src="/assets/activity/remark/images/conment.png"/>
    </div>
    <div class="phenomenon clearfix">
        <div class="title">{BEESCRM:$countPhenomenon}个候选现象</div>
        <volist name="data" id="vo"  offset="0" length='4'>
        <a href="{BEESCRM::U('activity/remark/detail',array('act_id'=>$act_id,'pid'=>$vo['id'],'i'=>$i,'wechat_id'=>$wechat_id))}">
        <div class="list">
            <p class="number fl-left">{BEESCRM:$i}</p>
            <p>
                <span>年度现象</span>
                <span>{BEESCRM:$vo.title}</span>
            </p>
            <img src="{BEESCRM:$vo.picture}"/>
        </div>
        </a>
       </volist>
        <if condition="$countPhenomenon gt 4"><a href="{BEESCRM::U('activity/remark/lists',array('act_id'=>$act_id,'wechat_id'=>$wechat_id))}" class="more">查看全部</a></if>
    </div>
    
    <div class="conment clearfix marginb-50">
        <div class="title">专家点评（{BEESCRM:$commentSum}）</div>
        <div id="commentList">
	        <volist name="comment" id="vo">
	        	<div class="list">
		            <div class="list-top clearfix">
		                <img class="fl-left" src="{BEESCRM:$vo.headimgurl}"/>
		                <span class="fl-left">{BEESCRM:$vo.nickname}</span>
		                <span class="time fl-right">{BEESCRM:$vo.create_time|date='Y-m-d',###}</span>
		            </div>
		            <p>{BEESCRM:$vo.content}</p>
		        </div>
	        </volist>
        </div>
        <a href="javascript:void(0)" class="more" id="allComment">查看全部</a>
    
    </div>
    
    <div class="btn-box">
        <a href="#" class="btn" id="comment">点评</a>
        <if condition="$voteState neq null"><a href="#" class="btn">已投票</a><else/><a href="{BEESCRM::U('activity/remark/vote',array('act_id'=>$act_id,'wechat_id'=>$wechat_id))}" class="btn">投票</a></if>
    </div>
    
    <div class="popbox"></div>
    <div class="pop-main" id="comment-box">
        <p class="pop-title">专家点评</p>
        <span class="iconfont icon-guanbi guanbi"></span>
        <div class="contain">
            <textarea placeholder="写下你的评语" name="content" id="content"></textarea>
        </div>
        <a href="javascript:void(0)" class="btn green-btn" id="confirm-commment">确认提交</a>
    </div>
    
</div>
<script src="/assets/activity/remark/js/jquery-2.1.0.min.js"></script>
<script>
    $(function(){
        $(window).load(function(){
            $('.pop-box1').hide();
        });
    })
		$('#comment').click(function(){
            $('.popbox').show();
            $('#comment-box').addClass('up');
        });
        $('.guanbi').click(function(){
            $('.popbox').fadeOut(500);
            $('#comment-box').removeClass('up');
        });
    $('#allComment').click(function(){
    	var limit = 'all';
    	$.ajax({
    		'url':"{BEESCRM::U('/Activity/Remark/commentMore',array('wechat_id'=>$wechat_id,'act_id'=>$act_id))}",
    		'type':'post',
    		'data':{'limit':limit,'act_id':{BEESCRM:$act_id} },
    		beforeSend:function(){
    			 $('.pop-box1').show();
    		},
    		 success:function(data){
    			 $('.pop-box1').hide();
    			 var json = $.parseJSON(data);
    			 if(json.status == 'S'){
    				 $('#commentList').html(json.html);
    				 $('#allComment').remove();
                     //infotips(json.message,$('.submit_tips'),'right');
                 }else{
                     infotips(json.message,$('.submit_tips'));
                 }
    		},
    		error:function(){
    			$('.pop-box1').hide();
    			infotips('获取失败',$('.submit_tips'));
    		},
    	})
    });
    $(document).on('click','#confirm-commment',function(){
        var comment = $('#content').val();
        comment = comment.replace(/^\s+|\s+$/g,"");
        if(!comment){
            infotips('评论内容不能为空',$('.submit_tips'));
            return false;
        }
        $.ajax({
            type:'post',
            dataType:'json',
            data:{'content':comment,'act_id':{BEESCRM:$act_id}},
            url:"{BEESCRM::U('/Activity/Remark/addComment',array('wechat_id'=>$wechat_id,'act_id'=>$act_id))}",
            success:function(data){
                if(data.status == 'S'){
                   // console.log(data);
                    infotips('评论成功',$('.submit_tips'),'right');
                    $('#comment').val('');
                    $('.popbox').hide();
                    $('#comment-box').removeClass('up');
                    window.location.reload();
                }else{
                    infotips('评论失败，请稍后再试',$('.submit_tips'));
                }
            },
            error:function(){
                infotips('评论失败，请稍后再试',$('.submit_tips'));
            },
        });
    });
</script>
</body>

</html>
